package com.studyhub.api.problem.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.studyhub.api.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

/**
 * 问题实体类
 * 
 * @author StudyHub Team
 */
@Getter
@Setter
@TableName("pr_problem")
@Schema(name = "Problem", description = "问题信息")
public class Problem extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "问题ID")
    private Long id;

    @Schema(description = "发布用户ID")
    private Long userId;

    @NotBlank(message = "问题标题不能为空")
    @Size(max = 255, message = "问题标题长度不能超过255字符")
    @Schema(description = "问题标题")
    private String title;

    @NotBlank(message = "问题内容不能为空")
    @Schema(description = "问题内容")
    private String content;

    @Size(max = 500, message = "标签长度不能超过500字符")
    @Schema(description = "问题标签，逗号分隔")
    private String tags;

    @Schema(description = "浏览次数")
    private Integer viewCount = 0;

    @Schema(description = "回答数量")
    private Integer answerCount = 0;

    @Schema(description = "点赞数量")
    private Integer likeCount = 0;

    @Schema(description = "收藏数量")
    private Integer collectCount = 0;

    @Schema(description = "状态：0-删除，1-正常，2-待审核")
    private Integer status = 1;

    @Schema(description = "是否已解决：0-未解决，1-已解决")
    private Integer isSolved = 0;

    @Schema(description = "最佳答案ID")
    private Long bestAnswerId;

    @TableLogic
    @Schema(description = "逻辑删除：0-未删除，1-已删除")
    private Integer deleted = 0;
}
